package com.wctj.api.business.common.service.impl;

import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wctj.api.base.entity.DdwxAdminSetappH5;
import com.wctj.api.base.utils.InstanceConvertUtil;
import com.wctj.api.business.common.dao.DdwxAdminSetappH5Mapper;
import com.wctj.api.business.common.dto.DdwxAdminSetappH5DTO;
import com.wctj.api.business.common.service.DdwxAdminSetappH5Service;
import org.springframework.stereotype.Service;

@Service
public class DdwxAdminSetappH5ServiceImpl extends ServiceImpl<DdwxAdminSetappH5Mapper, DdwxAdminSetappH5> implements DdwxAdminSetappH5Service {


    @Override
    public DdwxAdminSetappH5DTO findOneByPayType(int payType) {
        DdwxAdminSetappH5 setappApp = new LambdaQueryChainWrapper<>(baseMapper)
                .or(iq -> iq.eq(DdwxAdminSetappH5::getWxpay, payType))
                .or(iq -> iq.eq(DdwxAdminSetappH5::getAlipay, payType))
                .one();
        return InstanceConvertUtil.convertObject(setappApp, DdwxAdminSetappH5DTO.class);
    }
}
